﻿@model IEnumerable<Bordspil.Models.GroupMembers>

<div id ="groups">
    <div class ="group-name"><h3>@Model.FirstOrDefault().Group.GroupName</h3></div>
    <ul id="member-in-groups">
    @foreach (var user in Model)
    {
        var userInfo = user.UserProfile.UserName;
        if (user.Group.UserOwnerId == user.UserProfile.UserId)
        {
            <li id ="stofnandi"><strong>@Html.ActionLink(userInfo, "UserProfile", "Account", new { userName = userInfo }, null) </strong>stofnandi hópsins</li>
        }
        else
        {
            <li>@Html.ActionLink(userInfo, "UserProfile", "Account", new { userName = userInfo }, null)</li>
        }
    }
    </ul>
    <div id ="points"></div>
</div>

<script>
    $(document).ready(function () {
        GetGroupPoints();
        function GetGroupPoints() {
            var group = '@Model.FirstOrDefault().Group.GroupName';
            $.ajax({
                type: "GET",
                corntentType: "application/json; charset=utf-8",
                url: "/Highscore/GetGroupPoints",
                data: { "groupName": group },
                dataType: "json",
                success: function (data) {
                    $("#points").append("Heildar stig hops <strong>" + data + "</strong>");
                    //console.log(data);
                    
                }
            });
        }
     });
</script>